var status = -1;
var selectionLog = [];

function action(e, c, b) {
    if (status == 0 && e == 0) {
        cm.dispose();
        return
    }
    status++;
    selectionLog[status] = b;
    var a = -1;
    if (status <= a++) {
        cm.dispose()
    } else {
        if (status === a++) {
            if (!cm.isQuestFinished(34477)) {
                cm.hideNpc(3003422)
            }
            if (cm.isQuestActive(34474)) {
                var d = cm.getNumberFromQuestInfo(34474, "fin");
                if (d >= 1) {
                    cm.setPartner(1, 34480, 80002269, 0)
                }
                if (d >= 2) {
                    cm.setPartner(1, 34481, 80002269, 0)
                }
                if (d >= 3) {
                    cm.setPartner(1, 34482, 80002269, 0)
                }
                if (d >= 4) {
                    cm.setPartner(1, 34483, 80002269, 0)
                }
                if (d >= 5) {
                    cm.setPartner(1, 34484, 80002269, 0)
                }
                if (d >= 6) {
                    cm.setPartner(1, 34485, 80002269, 0)
                }
                if (d >= 7) {
                    cm.setPartner(1, 34486, 80002269, 0)
                }
            }
            cm.dispose()
        } else {
            cm.dispose()
        }
    }
}

function start() {
    status = -1;
    action(1, 0, 0)
};